package com.zoranjoka.chordis.pages;

import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.PageAttached;

import com.zoranjoka.chordis.beans.AlbumBean;
import com.zoranjoka.chordis.data.MockDataAlbum;

public class Albums {
	private MockDataAlbum dataAlbum;
	
	private AlbumBean albumBean;
	
	@InjectPage
	private AlbumDetails adPage;
	
	@PageAttached
	private void InitData() {
		dataAlbum = new MockDataAlbum();
	}

	@OnEvent(component = "songDetalilsLink")
	public Object onShowDetails(String name) {
		AlbumBean albumBean = dataAlbum.getAlbumByName(name);
		adPage.setAlbum(albumBean);
		return adPage;
	}

	public MockDataAlbum getDataAlbum() {
		return dataAlbum;
	}

	public void setDataAlbum(MockDataAlbum dataAlbum) {
		this.dataAlbum = dataAlbum;
	}

	public AlbumBean getAlbumBean() {
		return albumBean;
	}

	public void setAlbumBean(AlbumBean albumBean) {
		this.albumBean = albumBean;
	}
	
	
}
